<template>
  <div @click="playGame(item.play_url)" class="item">
    <div class="item__detail">
      <img class="item__icon" :src="item.icon">
      <div class="item__info">
        <p class="item__gamename">{{item.gamename}}</p>
        <p class="item__tags" v-if="item.category">{{item.category.replace(/,/g, ' | ')}}</p>
      </div>
    </div>
    <div class="item__server">
      <span :class="['item__name', { 'text_center': !item.start_time }]">{{item.ser_name}}</span>
      <span class="item__date" v-if="item.start_time">{{dateFormat(item.start_time, 'yyyy/MM/dd')}}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'rowServerItem',
  props: {
    item: {
      type: Object
    }
  }
}
</script>

<style scoped lang="scss">
.item {
  background-color: #fff;
  border-radius: 0.04rem;
  box-shadow: 0 0.02rem 0.1rem 0 rgba(0, 0, 0, 0.08);
  display: inline-block;
  height: 1.1rem;
  margin: 0 0.1rem 0.1rem 0;
  padding: 0 0.08rem;
  width: 2.1rem;

  &:last-child {
    margin-right: 0.15rem;
  }

  &__detail {
    align-items: center;
    border-bottom: 0.01rem solid #E8E8E8;
    display: flex;
    padding: 0.12rem 0;
  }

  &__info {
    flex: 1;
    overflow: hidden;
  }

  &__icon {
    border-radius: 0.1rem;
    height: 0.52rem;
    margin-right: 0.12rem;
    width: 0.52rem;
  }

  &__gamename {
    font-size: 0.13rem;
    font-weight: bold;
    margin-bottom: 0.07rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__tags {
    color: #666;
    font-size: 0.11rem;
    white-space: nowrap;
  }

  &__divider {
    color: #e8e8e8;
  }

  &__server {
    align-items: center;
    display: flex;
    line-height: 0.34rem;
  }

  &__name {
    color: #FF8600;
    flex: 1;
    font-size: 0.13rem;
  }

  &__date {
    color: #999;
    font-size: 0.1rem;
  }
}
</style>
